<div class="module-trade">
    <ol class="breadcrumb fn-clearfix">
        <li>交易管理</li>
        <li>交易查询</li>
    </ol>
    <div class="panel panel-warning">
        <div class="panel-body">
            <form class="form-inline ui-form" role="form">
                <div class="form-group ui-input-select">
                    <label for="symbol-type" class="control-label f-12">币种对：</label>
                    <select class="form-control" ng-model="vm.condition.symbol" ng-change="vm.changeSymbol()" id="symbol-type">
                        <option value="{{symbol.value}}" ng-repeat="symbol in symbolList">{{symbol.label}}</option>
                    </select>
                </div>
                <div class="form-group ui-input-select">
                    <label for="record-uid" class="control-label f-12">买家UID：</label>
                    <input type="text" class="form-control " placeholder="UID" ng-model="buyUid" id="record-uid">
                </div>
                <div class="form-group ui-input-select">
                    <label for="record-uid" class="control-label f-12">卖家UID：</label>
                    <input type="text" class="form-control " placeholder="UID" ng-model="sellUid" id="record-uid">
                </div>
                <br/>
                <div class="form-group">
                    <label class="control-label f-12">日期：</label>
                    <input type="date" ng-model="beginTime" class="form-control w180" ng-change="vm.changeStartDate(beginTime)">
                    -
                    <input type="date" ng-model="endTime" class="form-control w180" ng-change="vm.changeEndDate(endTime)"
                    ng-disabled="disabledEndDate"
                    min="{{min}}">
                </div>

                <!-- <div class="form-group ui-input-select">
                    <label for="record-email" class="control-label f-12">邮箱：</label>
                    <input type="text" class="form-control " placeholder="请输入email" ng-model="email" id="record-email">
                </div> -->
                <div class="form-group ui-input-select">
                    <label for="record-tid" class="control-label f-12">订单ID：</label>
                    <input type="text" class="form-control " placeholder="订单id" ng-model="tid" id="record-tid">
                    <button type="submit"  class="btn btn-primary" ng-click="vm.fetchList()">搜索</button>
                    <button type="submit"  class="btn btn-primary" ng-click="vm.download()">导出数据</button>
                </div>

            </form>

            <form action="{{url+'/exchange_manager/match/ordersExcel'}}" id="forms" style="display: none;">
                <input type="text" name="{{item.key}}" value="{{item.value}}" ng-repeat="item in vm.urlParam">
                <input type="submit" id="download">
            </form>
        </div>
    </div>

    <div class="ui-box">
        <div class="info-box">
            <span class="info-label">成交量：</span>
            <span class="info-text">{{vm.totalInfo.number}}{{vm.fetchedSymbol.trade}}</span>
            <span class="info-label">成交额：</span>
            <span class="info-text">{{vm.totalInfo.amount}}{{vm.fetchedSymbol.pricing}}</span>
            <span class="info-label">成交笔数：</span>
            <span class="info-text">{{vm.totalInfo.total}}</span>
        </div>
        <div class="info-box">
            <span class="info-label">手续费：</span>
            <span class="info-text">{{vm.totalInfo.buyFee}}{{vm.fetchedSymbol.trade}}</span>
            <span class="info-text">{{vm.totalInfo.sellFee}}{{vm.fetchedSymbol.pricing}}</span>
        </div>
        <table class="table table-striped table-hover table-bordered">
            <thead>
            <tr>
                <th width="12%">交易买单号</th>
                <th width="12%">交易卖单号</th>
                <th width="10%">成交时间</th>
                <th width="10%">币种对</th>
                <th width="10%">成交数量</th>
                <th width="10%">成交价格</th>
                <th width="10%">成交金额</th>
                <th width="12%">买方</th>
                <th width="12%">卖方</th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="item in vm.list" ng-if="vm.isLoading === false && vm.list.length > 0">
                <td>{{item.buyTradeTransferOrderNo}}</td>
                <td>{{item.sellTradeTransferOrderNo}}</td>
                <!-- <td>{{$root.moment(item.createDate).format('YYYY-MM-DD HH:mm:ss')}}</td> -->
                <td>{{$root.moment(item.createTime - 0).utc().utcOffset($root.ZONE).format('YYYY-MM-DD HH:mm:ss')}}</td>
                <td>{{vm.fetchedSymbol.trade}}/{{vm.fetchedSymbol.pricing}}</td>
                <td>{{item.num}}</td>
                <td>{{item.price}}</td>
                <td>{{item.priceAll}}</td>
                <td>{{item.buyUid}} {{ item.email ? '(' + item.email + ')' :''}}</td>
                <td>{{item.sellUid}} {{ item.sellemail ? '(' + item.sellemail + ')' :''}}</td>
            </tr>
            <tr class="ui-no-data" ng-if="vm.isLoading === false && (vm.list.length === 0||vm.list===null)">
                <td colspan="9">暂无数据</td>
            </tr>
            <tr class="ui-loading" ng-if="vm.isLoading === true">
                <td colspan="9">正在加载，请稍候...</td>
            </tr>
            </tbody>
        </table>

        <div class="ui-pager-box" ng-if="vm.totalNum > 0">
            <ul uib-pagination
                previous-text="上一页"
                next-text="下一页"
                first-text="首页"
                last-text="尾页"
                total-items="vm.totalNum"
                ng-model="vm.condition.pageNo"
                max-size="5"
                items-per-page="vm.pageSize || 10"
                align="right"
                class="pagination"
                boundary-links="true"
                ng-change="vm.pageChanged()"
                rotate="false"></ul>
        </div>
    </div>
</div>
